package com.hengda.museumonline.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.LinearLayout;

import com.daimajia.androidanimations.library.YoYo;
import com.daimajia.androidanimations.library.fading_entrances.FadeInUpAnimator;
import com.hengda.museumonline.R;
import com.nineoldandroids.animation.Animator;

/**
 * @author：JFWU on 2016/9/10 14:08
 * @E-mail：jeffy12138@126.com
 */
public class SplashActivity extends BaseActivity {
    private android.widget.LinearLayout splash;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        this.splash = (LinearLayout) findViewById(R.id.splash);
        YoYo.with(new FadeInUpAnimator())
                .interpolate(new AccelerateDecelerateInterpolator())
                .duration(2000)
                .withListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        finish();
                        Intent intent = new Intent(SplashActivity.this, MainActivity.class);
                        startActivity(intent);
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                }).playOn(splash);
    }
}
